home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.0
/
Video Toaster v4.0.iso
/
arexx
/
cg
/
savetextfile.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-02-16
|
1KB
|
56 lines
/* SaveTextFile.rexx -- Saves a page as an Ascii File. */
/* By Bob Caron © 1994 NewTek, Inc. */
call addlib(CG_AREXX,0)
filnam = 'ENV:SaveTextFile.state'
version = 'SaveTextFile v1.4'
if (exists(filnam)) then do
if (~open(state, filnam, 'R')) then break
if (readln(state) ~= version) then break
file=readln(state)
end
call close state
if file="" | file="FILE" then
file="toaster:CG/TextFiles/Page.txt"
if lastpos('/',file,length(file)-1)~=0 then do
filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
path=left(file,(lastpos('/',file,length(file))-1))
end
else do
filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
path=left(file,(lastpos(':',file,length(file))))
end
outfile=REQ_FILE("Save To Ascii File",filenam,path)
file=script
if (open(state, filnam, 'W')) then do
call writeln state, version
call writeln state, file
call close state
end
if outfile="" then
exit
if (~open(outfd,outfile,W)) then
call REQ_TELL("Can't open output:",file)
current_line=1
total_lines=GET_PAGE(SIZE)
do while current_line <= total_lines
call SET_LINE(current_line)
line=GET_LINE()
writeln(outfd,line)
current_line=current_line+1
end
call close(outfd)
call REQ_TELL("Saved...")
call remlib(CG_AREXX)
exit